package com.charles.seckillapi.feignService;

import com.charles.seckillapi.feignFallBack.RemoteLogServiceFallbackFactory;
import com.charles.seckillapi.model.UserLogin;
import com.charles.seckillcommon.core.constants.RoleConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * @author Charles-H
 * 
 * 远程调用日志业务
 */
@FeignClient(contextId = "remoteLogService", value = "seckillSystem", fallbackFactory = RemoteLogServiceFallbackFactory.class)
public interface RemoteLogService {

    /**
     * 记录登录日志
     */
    @PostMapping("/log/loginRecord")
    public void loginRecord(@RequestBody UserLogin user, @RequestHeader(RoleConstants.FROM_SOURCE) String source);

    /**
     * 记录退出登录日志
     */
    @PostMapping("/log/logoutRecord")
    public void logoutRecord(@RequestBody UserLogin user, @RequestHeader(RoleConstants.FROM_SOURCE) String source);

}
